package com.weixing.mall.provider.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.additional.query.impl.QueryChainWrapper;
import com.weixing.mall.provider.api.model.vo.SysDictVo;
import com.weixing.mall.provider.api.service.SysDictRPC;
import com.weixing.mall.provider.mapper.CategoryMapper;
import com.weixing.mall.provider.mapper.SceneMapper;
import com.weixing.mall.provider.model.domain.Category;
import com.weixing.mall.provider.model.domain.Scene;
import com.weixing.mall.provider.model.query.CategoryQuery;
import com.weixing.mall.provider.model.query.SceneQuery;
import com.weixing.mall.provider.model.vo.CategoryVo;
import com.weixing.mall.provider.service.ICategoryService;
import com.weixing.mall.provider.service.ISceneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/*
 * 商品搜索条件
 * */
@Service
public class QueryCriteriaImpl {

    @Autowired
    private CategoryMapper categoryMapper;

    @Autowired
    private SceneMapper sceneMapper;

    @Autowired

    private SysDictRPC sysDictRPC;

    /*
     * 获取商品搜索的搜索条件
     * */
    public Map<String, Object> initQueryCriteria() {
        Map<String,Object> result=new HashMap<String, Object>();
        //分类
        CategoryQuery query=new CategoryQuery();
        query.setCatLevel(1);
        List<CategoryVo> categoryList = categoryMapper.selectList(query);
        //场景
        List<Scene> sceneList = sceneMapper.selectList(new SceneQuery());
        //颜色
        List<SysDictVo>  colerList=sysDictRPC.getDictByCode("color").getData();
        //尺码
        List<SysDictVo>  sizeList=sysDictRPC.getDictByCode("size").getData();
        //袖长
        List<SysDictVo>  sleeveLengthList=sysDictRPC.getDictByCode("sleeveLength").getData();
        //衣长
        List<SysDictVo>  clothinglengthList=sysDictRPC.getDictByCode("clothinglength").getData();
        //衣宽
        List<SysDictVo>  shoulderwidthList=sysDictRPC.getDictByCode("shoulderwidth").getData();
        //胸围
        List<SysDictVo> bustList=sysDictRPC.getDictByCode("bust").getData();
        //腰围
        List<SysDictVo> waistList=sysDictRPC.getDictByCode("waist").getData();

        result.put("category",categoryList);
        result.put("scene",sceneList);
        result.put("coler",colerList);
        result.put("size",sizeList);
        result.put("sleeveLeng",sleeveLengthList);
        result.put("clothinglength",clothinglengthList);
        result.put("shoulderwidth",shoulderwidthList);
        result.put("bust",bustList);
        result.put("waist",waistList);

        return  result;

    }
}
